#include "elisa/elisa.h"
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <gaol/gaol>

#include "Modeler.h"

#ifdef ELISA_PERFORMER
#include "elisa_chrono.h"
#endif

using namespace std;
using namespace elisa;

class Simple : public Modeler
{
private:
	Model _model;

	RealConstant r;
	RealConstant c;
	RealVar x;
	RealVar y;
	RealConstraint c1;
	RealConstraint c2;

public:
	Simple()
		: r(10),
		  c(0),
		  //x(Interval::Universe, "x"),
		  x(Interval(-100, 100), "x"),
		  //x(Interval(1.8, 3.3), "x"),
		  y(Interval::Universe, "y"),
		  //y(Interval(-1, 1), "y"),
		  //y(Interval(-0.5, 1.5), "y"),
		  //c1(x == y),
		  c1(sin(x) == y),
		  //c2(x == r),
		  //c2(x == y),
		  c2(y == 0),
		  _model(c1 && c2)
	{
	}

	elisa::Model & model()
	{
		//_model = c1 && c2;
		return _model;
	}

	void print()
	{
		cout << '\t' << x.getName() << " = " << x.domain() << endl;
		cout << '\t' << y.getName() << " = " << y.domain() << endl;
		cout << '\t' << "r = " << r.getInterval() << endl;

		static ofstream fo("sol0.log");
		printAsRect(fo, x.domain(), y.domain());
		//fo << x.domain().mid() << " " << y.domain().mid() << endl;
	}

	RealVar & varX()
	{
		return x;
	}
	RealVar & varY()
	{
		return y;
	}
};
